#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
  /* 读取文件
   */
  // 1. 声明文件文件
  char *fPath =
      "/home/hera/workspace/projects/atguigu-c-songhk/core/code/file/write.txt";

  // 2. 打开文件
  FILE *pFile = fopen(fPath, "r");
  printf("%p\n", pFile);

  // 3. 读取文件
  char cBuffer[200];
  // fscanf(pFile, "%s", cBuffer);
  while (fgets(cBuffer, 200, pFile)) {
    printf("%s", cBuffer);
  }

  // 4. 关闭文件
  int rlt = fclose(pFile);
  printf("%d\n", rlt);
  return EXIT_SUCCESS;
}
